<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/22
 * Time: 8:34
 */


namespace Home\Model;
use Think\Model;
class AdminModel extends Model {
    protected $_validate=array(
        array('verify','require','验证码必须!'),//都有时间，都验证
        array('aname','require','用户名不能为空!'),//只在登录时验证
        array('aname','callback_checklen','用户名长度必须在5-15个字符长度之间',0,'callback'),
        array('apassword','require','密码不能为空!'),//只在登录时验证
    );
    protected $_auto = array (
        array('apassword','md5',3,'function') , // 对password字段在新增和编辑的时候使md5函数处理
    );
    function callback_checklen($param){
        if (strlen($param)>15 || strlen($param)<5){
            return false;
        }
        return true;
    }
}